package org.jeecg.modules.complain.vo;

import lombok.Data;

import java.math.BigDecimal;

/**
 * 报修统计
 * @Author liurui
 * @Date 2019/8/18 13:54
 * @Version 1.0
 **/
@Data
public class RepairReport {
    private Integer total; //报修总数
    private Integer completeNum; //已维修数
    private BigDecimal percent; //完成率

    public BigDecimal getPercent() {
        if (total == null || total == 0){
            return BigDecimal.ZERO;
        }
        if (completeNum == null || completeNum == 0){
            return BigDecimal.ZERO;
        }
        this.percent = new BigDecimal(completeNum).multiply(new BigDecimal(100)).divide(new BigDecimal(total),1,BigDecimal.ROUND_HALF_UP);
        return percent;
    }

}
